package design.pattern.flyweight;

/**
 * @author AtoVio, Winter Yuan
 */
public class Client {
    // 主函数
    public static void main(String[] args) {
        // 定义一个工厂类
        BoxFactory boxFactory = BoxFactory.getInstance();
        // 定义一个产品类
        AbstractBox box1 = boxFactory.getBox("O");
        box1.display("灰色");
        AbstractBox box2 = boxFactory.getBox("I");
        box2.display("黑色");
        AbstractBox box3 = boxFactory.getBox("L");
        box3.display("白色");
        AbstractBox box4 = boxFactory.getBox("L");
        box4.display("红色");

        System.out.println("两次获取到的L图形对象是否为同一个对象：" + (box3 == box4));
    }
}
